home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / XINE-1.ZIP / INJECTOR.ZIP / DOC / NEWCMDS < prev   
Encoding:
Text File  |  1996-10-25  |  1.8 KB  |  42 lines

  1. To add a new command you must add a definition in function initexternals
  2. in external.c. Add an entry in arrays ext_name and ext_func. The former is
  3. the command name ("do xxx"), the later a pointer to the function that will
  4. be called. Keep in mind that the last element of the vector ext_name must
  5. be a NULL pointer. Next write in inject.c the function that performs your
  6. job (put its prototype in inject.h). Use terminal I/O from conio.h to
  7. keep windowing working. In the routine you can define the variable hookfunc
  8. to point to a function supplied by you, which will be called (if ishooked
  9. is equal to 1!) every times a packet arrives. It gets 3 parameters: an
  10. unsigned char * to the raw received packet, an int with the packet 
  11. length and a struct netpacket * to a decoded version of the packet. Look
  12. in nettool.h for the explanation of the fileds in this struct. Have
  13. a look in inject.c at the examples before you write your routines.
  14.  
  15. Good Job!
  16.  
  17. Useful functions already present that you can use in your own new
  18. functions:
  19.  
  20. getvar(char * name)
  21.     Returns the value of the variable "name".
  22.  
  23. setvar(char * name, char * value)
  24.     Sets the value of the variable "name" to the input given as "value".
  25.  
  26. delvar(char * name)
  27.     Deletes the variable specified by the "name".
  28.  
  29. in_cksum(unsigned char * addr, unsigned len)
  30.     Returns the checksum of the buffer "addr" of lenght "len".
  31.  
  32. putipchecksum(unsigned char * packet, unsigned len)
  33.     Put the IP checksum and, if applicable, the TCP and UDP checksum to
  34.     the packet "packet" of lenght "len".
  35.  
  36. dopkt(char * what, int hm)
  37.     Sends the packet "what" of lenght "hm". It also fills the "ethernet
  38.     from" and "ethernet to" fields if respectively "fillethfrom" and
  39.     "fillethto" variables are set.
  40.  
  41.  
  42.